<?php
/**
* Controller Static VariousController
*
* @author SillySmart
* @copyright SillySmart
* @package Mvc.Controllers.Statics.VariousController
* @see Sls.Controllers.Core.SLS_FrontStatic
* @since 1.0
*/
class VariousController extends SLS_FrontStatic implements SLS_IStatic 
{

	public function __construct()
	{
		parent::__construct(true);
	}

	public function constructXML()
	{
		$this->_xmlToolBox->startTag('urls');
			$this->_xmlToolBox->addFullTag('home_index', $this->_generic->getFullPath('Home', 'Index'), true);
			$this->_xmlToolBox->addFullTag('home_contact', $this->_generic->getFullPath('Home', 'Contact'), true);
		$this->_xmlToolBox->endTag('urls');

		$this->_xmlToolBox->startTag('langs');
			$this->_xmlToolBox->startTag('lang');
				$this->_xmlToolBox->addFullTag('lang_url', $this->_generic->getFullPath('Home', 'Lang', array(array('key' => 'code', 'value' => 'en'))), true);
				$this->_xmlToolBox->addFullTag('lang_label', $GLOBALS[$GLOBALS['PROJECT_NAME']]['XSL']['SITE_ENGLISH'], true);
			$this->_xmlToolBox->endTag('lang');
			$this->_xmlToolBox->startTag('lang');
				$this->_xmlToolBox->addFullTag('lang_url', $this->_generic->getFullPath('Home', 'Lang', array(array('key' => 'code', 'value' => 'fr'))), true);
				$this->_xmlToolBox->addFullTag('lang_label', $GLOBALS[$GLOBALS['PROJECT_NAME']]['XSL']['SITE_FRENCH'], true);
			$this->_xmlToolBox->endTag('lang');
		$this->_xmlToolBox->endTag('langs');

		$qbd = new SLS_QueryBuilder();
		$socials = $qbd->select('*')
			->from('social')
			->order('social_id', 'asc')
			->execute();

		$this->_xmlToolBox->startTag('socials');
		foreach($socials as $social)
		{
			$this->_xmlToolBox->startTag('social');
			foreach($social as $key => $value)
				$this->_xmlToolBox->addFullTag($key, $value, true);
			$this->_xmlToolBox->endTag('social');
		}
		$this->_xmlToolBox->endTag('socials');

		$variablesToCrypt = array(
			'site_name' => $GLOBALS[$GLOBALS['PROJECT_NAME']]['XSL']['SITE_NAME'],
			'site_email' => $GLOBALS[$GLOBALS['PROJECT_NAME']]['XSL']['SITE_EMAIL'],
			'site_email_mailto' => 'mailto:'.$GLOBALS[$GLOBALS['PROJECT_NAME']]['XSL']['SITE_EMAIL'],
			'site_phone_fr' => $GLOBALS[$GLOBALS['PROJECT_NAME']]['XSL']['SITE_PHONE_FR'],
			'site_phone_us' => $GLOBALS[$GLOBALS['PROJECT_NAME']]['XSL']['SITE_PHONE_US']
		);

		$this->_xmlToolBox->startTag('data');
		foreach($variablesToCrypt as $key => $value)
		{
			$this->_xmlToolBox->addFullTag($key, SLS_String::crypt($value), true);
		}
		$this->_xmlToolBox->endTag('data');
	}
}
?>